package com.liy.cloud.common.pw.service.impl;

import com.liy.cloud.common.pw.dao.PwSystemStorageDao;
import com.liy.cloud.common.pw.entity.PwSystemStorageEntity;
import com.liy.cloud.common.pw.service.PwSystemStorageService;
import com.das.framework.common.dao.IBaseDao;
import com.das.framework.common.service.impl.BaseServiceImpl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 存储本站对应的库存信息 Service接口服务实现
 *
 * @author liyang
 * @ClassName: PwSystemStorageEntityServiceImpl
 * @Description:
 * @date: 2018-06-28 16:10:34
 */
@Service
public class PwSystemStorageServiceImpl extends BaseServiceImpl<PwSystemStorageEntity, String> implements PwSystemStorageService {
    protected static Logger log = LoggerFactory.getLogger(PwSystemStorageServiceImpl.class);

    @Autowired
    private PwSystemStorageDao storageEntityDao;

    @Override
    public IBaseDao<PwSystemStorageEntity, String> getDao() {
        return storageEntityDao;
    }

    @Override
    public int updateBySystemIdAndItemId(PwSystemStorageEntity entity) throws Exception {
        return storageEntityDao.updateBySystemIdAndItemId(entity);
    }

    @Override
    public PwSystemStorageEntity queryStorageBySystemIdAndItemId(String systemId, String itemId) throws Exception {
        return storageEntityDao.queryStorageBySystemIdAndItemId(systemId, itemId);
    }

    /*
     * @Author:  liyang
     * @Date:    2018/7/12  19:36
     * @Description: 通过车站编号systemId 查询车站所有的库存数据
     **/
    @Override
    public List<PwSystemStorageEntity> queryStorageDataBySystemId(String systemId) {
        return storageEntityDao.queryStorageDataBySystemId(systemId);
    }

    @Override
    public List<Map<String, Object>> getStorageNum() throws Exception {
        return storageEntityDao.getStorageNum();
    }

    @Override
    public int updateByCondition(PwSystemStorageEntity entity) throws Exception {
        return storageEntityDao.updateByCondition(entity);
    }

    @Override
    public PwSystemStorageEntity queryByCondition(PwSystemStorageEntity entity) throws Exception {
        return storageEntityDao.queryByCondition(entity);
    }
}